const db = require("../DBcofig/DBConnection");
module.exports = {
  //查询预约表单
  setserveation(res, sql, arr) {
    return new Promise((resolve, reject) => {
      db.dbconfig(res, sql, arr, function (data) {
        if (data != null) {
          resolve(data);
        }
        reject({
          code: 400,
          msg: "查询失败",
        });
      });
    });
  },
  setdoctortion(res, sql, whereArr) {
    return new Promise((resolve, reject) => {
      db.dbTransaction(res, sql, whereArr, function (data) {
        if (data != null) {
          resolve(data);
        }
        reject({
          code: 400,
          msg: "查询失败",
        });
      });
    });
  },
  //修改
  chageData(res, sql, arr) {
    return new Promise((resolve, reject) => {
      db.dbconfig(res, sql, arr, function (data) {
        console.log(data);
        if (data != null) {
          resolve({
            code: 200,
            msg: "成功返回",
          });
        }
        reject({
          code: 400,
          msg: "失败",
        });
      });
    });
  },
};
